package app.fugema.shop.main.order.model;

import androidx.databinding.Bindable;
import app.fugema.shop.BR;

import com.base.common.utils.DateUtils;
import com.base.common.utils.JavaMethod;
import com.base.common.view.adapter.bean.ChildBaseBean;

import java.math.BigDecimal;
import java.util.List;

public class GroupBookingBean {

    /**
     * code : 0
     * msg : 成功
     * data : {"records":[{"ruleId":5,"shopId":1,"shopName":"亚米小店1","prodId":18,"prodName":"Apple iPhone XS Max 移动联通电信4G手机 ","price":1.01,"content":"<p>测试商品<\/p>","oriPrice":0,"groupOnId":null,"joinEdCount":null,"pics":null,"discount":10,"discountMember":5,"expireTime":"2021-03-17 00:00:00","limitTime":2,"totalStocks":108,"brief":"6.5英寸大屏，支持双卡。","pic":"https://qiuzy.oss-cn-shenzhen.aliyuncs.com/app/20191126/3b031d0d914842e7a6e5ab0d4f31df9b.jpg","imgs":"https://qiuzy.oss-cn-shenzhen.aliyuncs.com/app/20191126/3b031d0d914842e7a6e5ab0d4f31df9b.jpg","picUrl":null,"categoryId":93,"skuId":120,"transport":null}],"total":1,"size":10,"current":1,"searchCount":true,"pages":1}
     */

    private int code;
    private String msg;
    private DataBean data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * records : [{"ruleId":5,"shopId":1,"shopName":"亚米小店1","prodId":18,"prodName":"Apple iPhone XS Max 移动联通电信4G手机 ","price":1.01,"content":"<p>测试商品<\/p>","oriPrice":0,"groupOnId":null,"joinEdCount":null,"pics":null,"discount":10,"discountMember":5,"expireTime":"2021-03-17 00:00:00","limitTime":2,"totalStocks":108,"brief":"6.5英寸大屏，支持双卡。","pic":"https://qiuzy.oss-cn-shenzhen.aliyuncs.com/app/20191126/3b031d0d914842e7a6e5ab0d4f31df9b.jpg","imgs":"https://qiuzy.oss-cn-shenzhen.aliyuncs.com/app/20191126/3b031d0d914842e7a6e5ab0d4f31df9b.jpg","picUrl":null,"categoryId":93,"skuId":120,"transport":null}]
         * total : 1
         * size : 10
         * current : 1
         * searchCount : true
         * pages : 1
         */

        private int total;
        private int size;
        private int current;
        private boolean searchCount;
        private int pages;
        private List<RecordsBean> records;

        public int getTotal() {
            return total;
        }

        public void setTotal(int total) {
            this.total = total;
        }

        public int getSize() {
            return size;
        }

        public void setSize(int size) {
            this.size = size;
        }

        public int getCurrent() {
            return current;
        }

        public void setCurrent(int current) {
            this.current = current;
        }

        public boolean isSearchCount() {
            return searchCount;
        }

        public void setSearchCount(boolean searchCount) {
            this.searchCount = searchCount;
        }

        public int getPages() {
            return pages;
        }

        public void setPages(int pages) {
            this.pages = pages;
        }

        public List<RecordsBean> getRecords() {
            return records;
        }

        public void setRecords(List<RecordsBean> records) {
            this.records = records;
        }


    }

    public static class RecordsBean extends ChildBaseBean {


        @Bindable
        public String getTimeHour() {
            long expireTimeL = DateUtils.dateStringToLong(expireTime) / 1000;//秒数
            long nowTime = System.currentTimeMillis() / 1000;
            long spec = expireTimeL - nowTime;
            if (spec <= 0) {
                return "00";
            } else {
                int h = (int) (spec / 3600);
                return JavaMethod.intValueOfString(h, 2);
            }
        }

        @Bindable
        public String getTimeMinute() {
            long expireTimeL = DateUtils.dateStringToLong(expireTime) / 1000;//秒数
            long nowTime = System.currentTimeMillis() / 1000;
            long spec = expireTimeL - nowTime;
            if (spec <= 0) {
                return "00";
            } else {
                int m = (int) (spec % 3600) / 60;
                return JavaMethod.intValueOfString(m, 2);
            }
        }

        @Bindable
        public String getTimeSecond() {
            long expireTimeL = DateUtils.dateStringToLong(expireTime) / 1000;//秒数
            long nowTime = System.currentTimeMillis() / 1000;
            long spec = expireTimeL - nowTime;
            if (spec <= 0) {
                return "00";
            } else {
                int s = (int) (spec % 60);
                return JavaMethod.intValueOfString(s, 2);
            }
        }

        //拼团商品列表切换
        public void timeChanged() {
            notifyPropertyChanged(BR.timeHour);
            notifyPropertyChanged(BR.timeMinute);
            notifyPropertyChanged(BR.timeSecond);
        }

        @Bindable
        public String getDateTime() {
            long time = DateUtils.getHour(DateUtils.dateStringToLong(startTime), limitTime);
            int spec = (int) (time - System.currentTimeMillis()) / 1000;

            if (spec <= 0) {
                return "";
            } else {
                int h = (int) (spec / 3600);
                int m = (int) (spec % 3600) / 60;
                int s = (int) (spec % 60);
                return h + "时" + m + "分" + s + "秒";
            }
        }

        //拼团订单切换
        public void dateChanged() {
            notifyPropertyChanged(BR.dateTime);
        }

        /**
         * ruleId : 5
         * shopId : 1
         * shopName : 亚米小店1
         * prodId : 18
         * prodName : Apple iPhone XS Max 移动联通电信4G手机
         * price : 1.01
         * content : <p>测试商品</p>
         * oriPrice : 0
         * groupOnId : null
         * joinEdCount : null
         * pics : null
         * discount : 10
         * discountMember : 5
         * expireTime : 2021-03-17 00:00:00
         * limitTime : 2
         * totalStocks : 108
         * brief : 6.5英寸大屏，支持双卡。
         * pic : https://qiuzy.oss-cn-shenzhen.aliyuncs.com/app/20191126/3b031d0d914842e7a6e5ab0d4f31df9b.jpg
         * imgs : https://qiuzy.oss-cn-shenzhen.aliyuncs.com/app/20191126/3b031d0d914842e7a6e5ab0d4f31df9b.jpg
         * picUrl : null
         * categoryId : 93
         * skuId : 120
         * transport : null
         */

        private int ruleId;
        private int shopId;
        private String shopName;
        private int prodId;
        private String prodName;
        private BigDecimal price;
        private String content;
        private BigDecimal oriPrice;
        private int discount;
        private int totalStocks;//库存量
        private String brief;
        private String pic;
        private String imgs;
        private int categoryId;
        private Object transport;

        private int groupOnId;
        private int joinEdCount;//已参加拼团的人数
        private Object picUrl;//拼团宣传图
        private int discountMember;//几人团
        private String expireTime;//团购过期时间
        private int limitTime;//拼团限制时间，单位小时(拼团开始后，超过限制时间，拼团失败)
        private int groupOnSuccessCount;//拼团的销量
        private List<String> pics;////已参与拼团用户头像
        private int skuId;
        private String skuName;//规格名称
        private String startTime;//开团时间
        private int status;//0拼团中 1拼团成功 2拼团失败

        //秒杀
        private int skId;
        private int limitCount;//秒杀的总数量
        private int saleCount;//已销售数量F


        public int getSkId() {
            return skId;
        }

        public void setSkId(int skId) {
            this.skId = skId;
        }

        public int getLimitCount() {
            return limitCount;
        }

        public void setLimitCount(int limitCount) {
            this.limitCount = limitCount;
        }

        public int getSaleCount() {
            return saleCount;
        }

        public void setSaleCount(int saleCount) {
            this.saleCount = saleCount;
        }

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public String getSkuName() {
            return skuName;
        }

        public void setSkuName(String skuName) {
            this.skuName = skuName;
        }

        public String getStartTime() {
            return startTime;
        }

        public void setStartTime(String startTime) {
            this.startTime = startTime;
        }

        public int getGroupOnSuccessCount() {
            return groupOnSuccessCount;
        }

        public void setGroupOnSuccessCount(int groupOnSuccessCount) {
            this.groupOnSuccessCount = groupOnSuccessCount;
        }

        public int getRuleId() {
            return ruleId;
        }

        public void setRuleId(int ruleId) {
            this.ruleId = ruleId;
        }

        public int getShopId() {
            return shopId;
        }

        public void setShopId(int shopId) {
            this.shopId = shopId;
        }

        public String getShopName() {
            return shopName;
        }

        public void setShopName(String shopName) {
            this.shopName = shopName;
        }

        public int getProdId() {
            return prodId;
        }

        public void setProdId(int prodId) {
            this.prodId = prodId;
        }

        public String getProdName() {
            return prodName;
        }

        public void setProdName(String prodName) {
            this.prodName = prodName;
        }

        public BigDecimal getPrice() {
            return price;
        }

        public void setPrice(BigDecimal price) {
            this.price = price;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public BigDecimal getOriPrice() {
            return oriPrice;
        }

        public void setOriPrice(BigDecimal oriPrice) {
            this.oriPrice = oriPrice;
        }

        public int getGroupOnId() {
            return groupOnId;
        }

        public void setGroupOnId(int groupOnId) {
            this.groupOnId = groupOnId;
        }

        public int getJoinEdCount() {
            return joinEdCount;
        }

        public void setJoinEdCount(int joinEdCount) {
            this.joinEdCount = joinEdCount;
        }

        public List<String> getPics() {
            return pics;
        }

        public void setPics(List<String> pics) {
            this.pics = pics;
        }

        public int getDiscount() {
            return discount;
        }

        public void setDiscount(int discount) {
            this.discount = discount;
        }

        public int getDiscountMember() {
            return discountMember;
        }

        public void setDiscountMember(int discountMember) {
            this.discountMember = discountMember;
        }

        public String getExpireTime() {
            return expireTime;
        }

        public void setExpireTime(String expireTime) {
            this.expireTime = expireTime;
        }

        public int getLimitTime() {
            return limitTime;
        }

        public void setLimitTime(int limitTime) {
            this.limitTime = limitTime;
        }

        public int getTotalStocks() {
            return totalStocks;
        }

        public void setTotalStocks(int totalStocks) {
            this.totalStocks = totalStocks;
        }

        public String getBrief() {
            return brief;
        }

        public void setBrief(String brief) {
            this.brief = brief;
        }

        public String getPic() {
            return pic;
        }

        public void setPic(String pic) {
            this.pic = pic;
        }

        public String getImgs() {
            return imgs;
        }

        public void setImgs(String imgs) {
            this.imgs = imgs;
        }

        public Object getPicUrl() {
            return picUrl;
        }

        public void setPicUrl(Object picUrl) {
            this.picUrl = picUrl;
        }

        public int getCategoryId() {
            return categoryId;
        }

        public void setCategoryId(int categoryId) {
            this.categoryId = categoryId;
        }

        public int getSkuId() {
            return skuId;
        }

        public void setSkuId(int skuId) {
            this.skuId = skuId;
        }

        public Object getTransport() {
            return transport;
        }

        public void setTransport(Object transport) {
            this.transport = transport;
        }
    }
}
